package DAD.sunday;

public class Test {
    public static void main(String[] args) {
        Animal[] animal = new Animal[4];
        animal[0] = new Dog("旺财", 1, "白色");
        animal[1] = new Fish("小鲤鱼", 1, "红色");
        animal[2] = new Chick("鸡仔", 1, "黄色色");
        animal[3] = new Dog("小黑", 1, "黑色");
        Master master = new Master();
        for (int i = 0; i < animal.length; i++) {
            animal[i].eat();
            master.feed(animal[i]);
            if (animal[i] instanceof Swim) {
                Swim s = (Swim) animal[i];
                s.swim();
            }
            if (animal[i] instanceof Chick) {
                Chick chick = (Chick) animal[i];
                chick.layEggs();

            }
            if (animal[i] instanceof Dog){
                Dog dog = (Dog) animal[i];
                dog.lookhome();
            }
        }

    }
}
